li = ["北京","上海","广东"]

# （1）将中国省会城市添加到列表里
city = ["天津","重庆","哈尔滨","沈阳","石家庄","兰州","西安"
        ,"郑州 ","太原 ","长沙","南京 ","贵阳 ","南宁 ","杭州"
        ,"广州 ","台北 ","海口 ","福州 ","南昌 ","拉萨 ","昆明 "
        ,"成都","武汉 ","合肥 ","济南 ","银川 ","西宁 ","乌鲁木齐 ",
        "呼和浩特 ","长春"]
for i in range(30):
        li.append(city[i])
# （2）广东成为第二大发达城市，将广东排在上海前面
li.insert(1,li.pop(2))
print(li)
# （3）这是中国GDP排名前8的城市的GDP数值，请统计前8城市的GDP总和，平均GDP。
li1 = [36710.36,35427.10,29863.23,29667.39,27665.36,27650.45,27620.38,25369.20]
print("中国前8城市的GDP总和为 :",sum(li1))
print("中国前8城市的平均GDP为 :",sum(li1)/8)